home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / PROCED3.MOD < prev    next >
Text File  |  1989-01-18  |  748b  |  34 lines

  1.                                          (* Chapter 5 - Program 3 *)
  2. MODULE Proced3;
  3.  
  4. FROM InOut IMPORT WriteString, WriteCard, WriteLn;
  5.  
  6. VAR Apple, Orange, Pear, Fruit : CARDINAL;
  7.  
  8. PROCEDURE AddTheFruit (Value1,Value2 : CARDINAL;  (* One-way *)
  9.                        VAR Total     : CARDINAL;  (* Two-way *)
  10.                        Value3        : CARDINAL); (* One-way *)
  11. BEGIN
  12.    Total := Value1 + Value2 + Value3;
  13. END AddTheFruit;
  14.  
  15. BEGIN  (* Main Program *)
  16.    Apple := 4;
  17.    Orange := 7;
  18.    Pear := 5;
  19.    AddTheFruit(Apple,Pear,Fruit,Orange);
  20.    WriteString("The total number of fruits is ");
  21.    WriteCard(Fruit,5);
  22.    WriteLn;
  23. END Proced3.
  24.  
  25.  
  26.  
  27.  
  28. (* Result of execution
  29.  
  30. The total number of fruits is    16
  31.  
  32. *)
  33.  
  34.